//
//  WSJSweepViewController.m
//  RunningMan
//
//  Created by JGT on 16/6/4.
//  Copyright © 2016年 WSJ. All rights reserved.
//

#import "WSJSweepViewController.h"
#import "WSJView.h"
@interface WSJSweepViewController ()<WSJViewDelegate>

@end

@implementation WSJSweepViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    WSJView *qrView =  [[WSJView alloc]initWithFrame:self.view.bounds];
    qrView.delegate = self;
    [self.view addSubview:qrView];
}
- (void)qrView:(WSJView *)view ScanResult:(NSString *)result {
    [view stopScan];
    UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil message:[NSString stringWithFormat:@"扫描结果：%@", result] preferredStyle:UIAlertControllerStyleAlert];
    [alert addAction:[UIAlertAction actionWithTitle:@"Sure" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
        [view startScan];
    }]];
    [self presentViewController:alert animated:true completion:nil];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
